import cs.BlockingIoExample;
import cs.ConnectExample;
import cs.NonBlockingIoExample;
import org.junit.Test;
import vip.ipav.log.util.LoggerTools;

import java.util.concurrent.CountDownLatch;

public class ServerAndClient {

    //阻塞
    @Test
    public void createServerBio() throws Exception {
        LoggerTools.getConsoleLogger().info("创建服务端-阻塞");
        BlockingIoExample blockingIoExample = new BlockingIoExample();
        blockingIoExample.serve(3368);
    }

    //异步
    @Test
    public void createServerNio() throws Exception {
        LoggerTools.getConsoleLogger().info("创建服务端-异步");
        NonBlockingIoExample blockingIoExample = new NonBlockingIoExample();
        blockingIoExample.serve(3368);
    }

    @Test
    public void startClient() throws InterruptedException {
        ConnectExample.connect("127.0.0.1",3368);
    }
}
